package su.mvc.service;


import java.util.logging.Logger;

public class UserService extends DaoSupport{

    private static final Logger log = Logger.getLogger(UserService.class.getName());

    
    private String adminNick;
    
    private GoogleService googleService;

    public String getAdminNick() {
        return adminNick;
    }

    public void setAdminNick(String adminNick) {
        this.adminNick = adminNick;
    }

    public GoogleService getGoogleService() {
        return googleService;
    }

    public void setGoogleService(GoogleService googleService) {
        this.googleService = googleService;
    }
    
    public String getUserNick() {
        return googleService.getUserNickName();
    }
    
    public boolean isUserAuthorized() {
        return googleService.isUserLoggedIn();
    }

    public boolean isUserAdmin() {
        return googleService.isUserLoggedIn() && googleService.getUserNickName().equalsIgnoreCase(getAdminNick());
    }
    
    public String getLoginPage(String currentPage) {
        return googleService.getLoginUri(currentPage);
    }

    public String getLogoutPage(String currentPage) {
        return googleService.getLogoutUri(currentPage);
    }
}
